package com.itheima.service.Impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.itheima.dao.MemberDao;
import com.itheima.pojo.Member;
import com.itheima.service.MemberService;
import com.itheima.utils.MD5Utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

@Service(interfaceClass = MemberService.class)
@Transactional
public class MemberServiceImpl implements MemberService {
    @Autowired
    private MemberDao memberDao;

        public Member findByTelephone(String telephone) {
            return null;
        }

        //保存会员信息
        public void add(Member member) {
            String password = member.getPassword();
            if (password == null){
                //使用MD5对密码加密
                password = MD5Utils.md5(password);
                member.setPassword(password);
            }
            memberDao.add(member);
    }
}
